package org.bet.utils;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public abstract class ServletRequestUtils extends org.springframework.web.bind.ServletRequestUtils {
	public static String getRequestParameterAsString(HttpServletRequest request, String separator) {
		
		
		StringBuffer sb = new StringBuffer();
		
		if(request != null){
			Enumeration<String> e = request.getParameterNames();
			
			while(e.hasMoreElements()){
				String name = e.nextElement();
				String value = request.getParameter(name);
				sb.append(name)
				  .append("=>")
				  .append(value)
				  .append(StringUtils.defaultIfEmpty(separator, ","));
			}
		}
		return sb.toString();
	}
}
